<%@page import="java.util.Iterator"%>
<%@page import="Domain.Website"%>
<%@page import="Domain.PostBean"%>
<%@page import="Domain.BlogBean"%>
<%@ page import="java.util.*"%>
	
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Sidebar</title>
    </head>
    <body>
        <div class="sidebar">
		<%
			if(request.getParameter("blog")!= null){
				int tmp = Integer.parseInt(request.getParameter("blog"));
				BlogBean blog =	Website.getInstance().getBlog(tmp); 
				
				Iterator it = blog.getAllPosts();
				while(it.hasNext()){
					PostBean post =  (PostBean)it.next();
					%>
					<a href="blogview.jsp?post=
					<%= post.getpostId()%>">
					<%= post.getHeader()%> </a> 
					<%out.println("(" + post.getCommentCount() + ")");
					out.println("<br/>");
				}
			}
		%>
        </div>
    </body>
</html>
